package cn.leyaber.hrm.clients;


import cn.leyaber.hrm.fallback.CommonFeignClientFallbackFactory;
import cn.leyaber.hrm.util.AjaxResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

//用来调用 common-server ，操作Redis
@FeignClient(value = "common-server", fallbackFactory = CommonFeignClientFallbackFactory.class)
public interface CommonFeignClient {

    @RequestMapping(value = "/redis/set",method = RequestMethod.POST)
    AjaxResult set(@RequestParam("key") String key  ,
                   @RequestParam("value")String value);

    @RequestMapping(value = "/redis/setex",method = RequestMethod.POST)
    AjaxResult setex(@RequestParam("key") String key  ,
                            @RequestParam("seconds")int seconds,
                            @RequestParam("value")String value);

    // //操作Redis: 取值 : get/xxx
    @RequestMapping(value = "/redis/get/{key}",method = RequestMethod.GET)
    AjaxResult get(@PathVariable("key") String key);

    //删除KEY
    @RequestMapping(value = "/redis/del/{key}",method = RequestMethod.DELETE)
    AjaxResult del(@PathVariable("key") String key);
//
//    //保存商品
//    @RequestMapping(value="/es/save/course",method = RequestMethod.POST)
//    AjaxResult saveCourse(@RequestBody CourseDoc courseDoc);
//
//    //查询商品
//    @RequestMapping(value = "/es/queryCourse",method = RequestMethod.POST)
//    AjaxResult queryCourse(@RequestBody CourseQuery courseQuery);
//    //查询
//    @RequestMapping(value = "/es/querySax",method = RequestMethod.POST)
//    AjaxResult querySax(@RequestBody SaxQuery saxQuery);
//    //加入购物车
//    @RequestMapping(value = "redis/saveOrUpdate/{key}",method = RequestMethod.POST)
//    AjaxResult addSax(@RequestBody CourseDoc courseDoc);

}
